import 'package:chatbot/model/role_model.dart';

class RoleListModel {
  late int code;
  late DataBean data;
  late String message;

  static RoleListModel fromMap(Map<String, dynamic> map) {
    RoleListModel roleListModelBean = RoleListModel();
    roleListModelBean.code = map['code'];
    roleListModelBean.data = DataBean.fromMap(map['data']);
    roleListModelBean.message = map['message'];
    return roleListModelBean;
  }

  Map toJson() => {
        "code": code,
        "data": data,
        "message": message,
      };
}

class DataBean {
  late int endRow;
  late bool hasNextPage;
  late bool hasPreviousPage;
  late bool isFirstPage;
  late bool isLastPage;
  late List<Role> list;
  late int navigateFirstPage;
  late int navigateLastPage;
  late int navigatePages;
  late int nextPage;
  late int pageNum;
  late int pageSize;
  late int pages;
  late int prePage;
  late int size;
  late int startRow;
  late int total;

  static DataBean fromMap(Map<String, dynamic> map) {
    DataBean dataBean = DataBean();
    dataBean.endRow = map['endRow'];
    dataBean.hasNextPage = map['hasNextPage'];
    dataBean.hasPreviousPage = map['hasPreviousPage'];
    dataBean.isFirstPage = map['isFirstPage'];
    dataBean.isLastPage = map['isLastPage'];
    dataBean.list = []
      ..addAll((map['list'] as List ?? []).map((o) => Role.fromMap(o)));
    dataBean.navigateFirstPage = map['navigateFirstPage'];
    dataBean.navigateLastPage = map['navigateLastPage'];
    dataBean.navigatePages = map['navigatePages'];

    dataBean.nextPage = map['nextPage'];
    dataBean.pageNum = map['pageNum'];
    dataBean.pageSize = map['pageSize'];
    dataBean.pages = map['pages'];
    dataBean.prePage = map['prePage'];
    dataBean.size = map['size'];
    dataBean.startRow = map['startRow'];
    dataBean.total = map['total'];
    return dataBean;
  }

  Map toJson() => {
        "endRow": endRow,
        "hasNextPage": hasNextPage,
        "hasPreviousPage": hasPreviousPage,
        "isFirstPage": isFirstPage,
        "isLastPage": isLastPage,
        "list": list,
        "navigateFirstPage": navigateFirstPage,
        "navigateLastPage": navigateLastPage,
        "navigatePages": navigatePages,
        "nextPage": nextPage,
        "pageNum": pageNum,
        "pageSize": pageSize,
        "pages": pages,
        "prePage": prePage,
        "size": size,
        "startRow": startRow,
        "total": total,
      };
}
